package com.zhuangwei.service;

import com.zhuangwei.mapper.UserMapper;
import com.zhuangwei.pojo.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author LeviCoder
 * @create 2019-03-09 22:17
 */
@Service
public class UserService {
    @Autowired
    private UserMapper userMapper;

    public int addUser(User user) {
        int insert = this.userMapper.insert(user);
        if (insert > 0) {
            return insert;
        }
        return 0;
    }

    public User queryById(Long id) {
        return this.userMapper.selectByPrimaryKey(id);
    }
}
